home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-12-08 | 1.5 KB | 41 lines | [TEXT/JEFF] |
- 00 NOOP THIS PROGRAM CREATE IN THE DATA STACK THE FIRST N
- 01 NOOP FIBONACCI NUMBERS IN THE DOWWNWARD ORDER. TO GET A
- 02 NOOP NEW FIBONACCI NUMBER YOU ADD UP THE LAST TWO YOU
- 03 NOOP GOT AND THE FIRST TWO FIBONACCI NUMBERS ARE 1.
- 04 NOOP --------------------------------------------------
- 05 ILIT 15 ADDRESS 0 STORES THE OFFSET OF THE # NEXT TO THE LAST
- 06 PUSH 13 ALLOCATE MEMORY SPACE----N = 15
- 07 ILIT 1
- 08 ILIT 1 PUSH THE FIRST TWO FILSONACCI NUMBERS
- 09 DUPL TAKE ADVANTAGE OF THE FACT THAT THE FIRST TWO ARE EQ
- 10 NOOP -------------------------------------------
- 11 LOAD 0 0
- 12 DUPL MAKE A COPY OF IT FOR LATER USE
- 13 ILIT 2
- 14 LSEQ TEST WHETHER THE OFFSET IS <= 2
- 15 BRTR 37 IF TRURE, STOP
- 16 NOOP ----------------------------------------
- 17 REF 0 0
- 18 ADD PRODUCE THE ADDRESS FOR THE # NEXT TO THE LAST
- 19 ILOD
- 20 ADD PRODUCE THE NEXT FILSONACCI NUMBER
- 21 DUPL
- 22 NOOP ---------------------------------------------
- 23 LOAD 0 0
- 24 DUPL
- 25 ILIT 1
- 26 SUB UPDATE THE OFFSET
- 27 STOR 0 0
- 28 NOOP ---------------------------------------------
- 29 ILIT 2
- 30 SUB PRODUCE THE OFFSET TO STORE THE NEW NUMBER
- 31 REF 0 0
- 32 ADD PRODUCE THE ADDRESS TO STORE THE NEW NUMBER
- 33 EXCH
- 34 ISTO STORE THE NEW NUMBER
- 35 BUNC 11
- 36 NOOP --------------------------------------------
- 37 POP 2 REMOVE THE COPY OF ADDRESS 0 & THAT OF THE LAST #
- 38 STOP
- DUMP
-